<template>
  <div :class="['flow-process-node__end-container', readonly ? 'cursor-default' : null, store.currFlow.type == data.type && store.currFlow.id == data.id ? 'active':'']" @click="onContentClick">
    <i :class="['iconfont', data.icon]" :style="{  color: data.type === 'close' && '#F56C6C'}"></i> {{ data.title }}
  </div>
</template>

<script>

import emitter from '../emit';
import { store } from '../constant'
export default {
  name: 'biz-flow-process-end-node',
  props: {
    data: {
      type: Object,
      default: null
    },
    nodeList: {
      type: [Array, null],
      default() {
        return null
      }
    },
  },
  data() {
    return  {
      readonly: store.readonly,
      store
    }
  },
  methods: {
    onContentClick() {
      store.currFlow = this.data;
      emitter.emit('node-content-click', this.data, this.nodeList)
    },
  }
}
</script>

<style lang="scss" scoped>
.flow-process-node__end-container {
  width: 208px;
  height: 48px;
  border-radius: 4px;
  box-shadow: 0 1px 5px 0 rgba(10, 30, 65, 0.08);
  color: #595959;
  line-height: 48px;
  text-align: left;
  // background: #F5F8FA;
  font-size: 14px;
  border: 1px solid #CBD6E2;
  cursor: pointer;
  box-sizing: border-box;
  padding: 0 10px;
  @include text-ellipsis;
  &.active {
    background: $color-primary-light-1;
    border: 1px solid $color-primary;
  }
}
</style>
